package toyexamples;

import java.util.EmptyStackException;
public class Stack {
	private static int MAX_ELEMENTS=100 ;
	int[] values;
	int size;	
	public Stack() {
		values = new int[MAX_ELEMENTS];
		size = 0;
	}

	public void push(int x) {
		if (isFull())
			System.out.print("MAX!");//1
		else
			values[size++] = x;//2
}
	
	public void print_stack(char size){
		String monthString="";
	        switch (size) {
	        case '1':  monthString = "January";
	                     break;
            case '3': // weekyear (number)
            case 'A': // year (number)
            case 'D': // year of era (number)
            		monthString = "February";
	                     break;

	            default: monthString = "Invalid month";
	                     break;
	        }
	        System.out.println(monthString);

	}
	
	public int pop() {
		if (isEmpty()) { //May imply coverage in push and resize
			throw new EmptyStackException();//3
		} else {
			return values[--size];//4
		}
	}

	private boolean isFull() {

		if (size >= MAX_ELEMENTS)
			return true;//5
		else
			return false;//6

	}

	private boolean isEmpty() {
		if (size == 0)
			return true;//7
		else
			return false;//8
	}

	public int top() {
		if (isEmpty())
			throw new EmptyStackException();
		else
			return values[size - 1];
	}
}
